home *** CD-ROM | disk | FTP | other *** search
/ Building Homes of Our Own / Building Homes of our Own.iso / setup / data1.cab / Everything / working / siteSel.dxr / graphics_2_RegionChoiceMusicFrameScript.ls < prev    next >
Encoding:
Text File  |  2002-09-25  |  1.9 KB  |  77 lines

  1. property musicList, curMusic, soundChn, lastRoll, fadingout, curVol, inc, fadeOutDone, soundVol, musicSpritesList
  2.  
  3. on beginSprite me
  4.   musicList = [#rl: "coas", #coast: "Locate", #sub: "rura", #urb: "urba"]
  5.   musicSpritesList = [:]
  6.   repeat with thisRegion in [#urb, #sub, #rl, #coast]
  7.     thisSprite = sendAllSprites(#getRegion, thisRegion)
  8.     setaProp(musicSpritesList, thisSprite, thisRegion)
  9.   end repeat
  10.   soundChn = 1
  11.   soundVol = the volume of sound soundChn
  12.   curVol = soundVol
  13.   inc = 15
  14. end
  15.  
  16. on exitFrame me
  17.   thisRoll = 0
  18.   if modalWindowUp() then
  19.     go(the frame)
  20.     exit
  21.   end if
  22.   repeat with x = 1 to 4
  23.     thisSprite = getPropAt(musicSpritesList, x)
  24.     if rollover(thisSprite) then
  25.       if thisSprite = lastRoll then
  26.         go(the frame)
  27.         exit
  28.         next repeat
  29.       end if
  30.       curRegion = getAt(musicSpritesList, x)
  31.       curMusic = musicList[curRegion]
  32.       rollSprite = thisSprite
  33.       lastRoll = thisSprite
  34.       exit repeat
  35.     end if
  36.   end repeat
  37.   if rollSprite = 0 then
  38.     if lastRoll <> rollSprite then
  39.       fadingout = 1
  40.       lastRoll = rollSprite
  41.       go(the frame)
  42.       exit
  43.     end if
  44.     if fadeOutDone then
  45.       sound(soundChn).stop()
  46.       set the volume of sound soundChn to soundVol
  47.       curVol = soundVol
  48.       fadingout = 0
  49.       go(the frame)
  50.       exit
  51.     end if
  52.     if fadingout then
  53.       curVol = curVol - inc
  54.       if curVol < 0 then
  55.         curVol = 0
  56.         fadeOutDone = 1
  57.       end if
  58.       set the volume of sound soundChn to curVol
  59.       go(the frame)
  60.       exit
  61.     end if
  62.     go(the frame)
  63.     exit
  64.   end if
  65.   if soundBusy(soundChn) then
  66.     sound(soundChn).stop()
  67.   end if
  68.   sound(soundChn).setPlayList([])
  69.   sound(soundChn).queue([#member: member(curMusic), #preloadTime: 1000])
  70.   sound(soundChn).play()
  71.   fadeOutDone = 0
  72.   fadingout = 0
  73.   set the volume of sound soundChn to soundVol
  74.   curVol = soundVol
  75.   go(the frame)
  76. end
  77.